﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<ali:Get ID="Instance" Object="Instance" InnerID="Request.QueryString['ID']" Validate="True" />
<ali:List ID="Module" Object="Module" Page="1" PageSize="1" Condition="ID=Instance[ModuleID]" />
<script language="c#" runat="server">
protected string HasSubInstance(object ns)
{
	DataRow[] rows = Manager.Objects.Select(Alias.Module.Object.Namespace + "='" + ns + "' and " + Alias.Module.Object.Name + "='SubInstance'");
	if (rows.Length > 0)
		return "true";
	else
		return "false";
}
</script>
<section data-page="instance_edit" data-title="编辑实例" data-lang="<%=ContentLang%>" data-id="<%=Request.QueryString["ID"]%>">
	<dl class="path1">
		<dt><span>您的位置：</span><a href="list.aspx?Lang=<%=ContentLang%>" target="ali-navtab">实例列表</a> → <b class="<%=ContentLang%>Font"><%=Instance[Name]%></b></dt>
		<dd>
			<select data-class="<%=ContentLang%>Font" data-ali-widget="combo">
				<ali:List Object="Language" Source="Manager.Languages">
					<ali:Record>
						<%If Convert.ToString(Ab) == ContentLang%>
							<option value="<%=Ab%>" selected><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%Else%>
							<option value="<%=Ab%>"><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%EndIf%>
					</ali:Record>
				</ali:List>
			</select>
		</dd>
	</dl>
	<form action="" class="post">
		<div class="post-body">
			<table class="post-table margin2">
				<tr>
					<th>全球唯一标识符：</th>
					<td><%=(new Guid(Instance[ID].ToString())).ToString("B").ToUpper()%></td>
				</tr>
				<tr>
					<th>模块：</th>
					<td class="<%=ContentLang%>Font"><%=Module[Label]%></td>
				</tr>
				<tr>
					<th>名称：</th>
					<td><input type="text" name="Name" value="<%=Instance[Name]%>" maxlength="50" class="ali-input <%=ContentLang%>Font"></td>
				</tr>
				<tr>
					<th>数据库提供者：</th>
					<td>
						<select name="DatabaseProvider" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
							<option value="OleDb">OleDb</option>
						</select>
					</td>
				</tr>
				<tr>
					<th>连接字符串：</th>
					<td>
						<input type="text" name="ConnectionString" value="<%=Instance[ConnectionString]%>" size="60" maxlength="255" class="ali-input">
						<br>{#WebPath#}表示网站根目录，{#DataPath#}表示数据库目录
					</td>
				</tr>
				<%If Convert.ToBoolean(HasSubInstance(Module[Namespace]))%>
					<tr>
						<th>多用户：</th>
						<td>
							<%If Convert.ToBoolean(Instance[IsMultiUser])%>
								<label><input type="radio" name="IsMultiUser" value="true" checked>是</label>
								<label><input type="radio" name="IsMultiUser" value="false">否</label>
							<%Else%>
								<label><input type="radio" name="IsMultiUser" value="true">是</label>
								<label><input type="radio" name="IsMultiUser" value="false" checked>否</label>
							<%EndIf%>
						</td>
					</tr>
				<%EndIf%>
			</table>
		</div>
		<div class="post-footer"><button type="submit" class="ali-button">保 存</button></div>
	</form>
</section>